package com.jsh.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jsh.entity.ShopOrderDetail;
import com.jsh.IShopOrderDetailService;
import com.jsh.uitls.CommonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author jsh
 * @since 2022-11-16
 */
@RestController
@RequestMapping("/shop-order-detail")
@Api(value = "订单详细信息接口", tags = "订单信息接口")
public class ShopOrderDetailController {

    @Autowired
    private IShopOrderDetailService shopOrderDetailService;


    @ApiOperation("订单详细信息根据id查询接口")
    @RequestMapping("/orderDetail/findById")
    public CommonResult selectById(Integer id){

        QueryWrapper<ShopOrderDetail> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("order_Id",id);
        List<ShopOrderDetail> list = shopOrderDetailService.list(queryWrapper);
        return CommonResult.ok(list);
    }

    @ApiOperation("订单详细详细保存接口")
    @RequestMapping("/orderDetail/save")
    public CommonResult save(@RequestBody ShopOrderDetail shopOrderDetail){

        shopOrderDetailService.save(shopOrderDetail);

        return CommonResult.ok();
    }




}

